package abc.dev.auth.to;

import abc.model.IEntity;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import abc.annotation.Associative;
import java.util.List;
import java.util.Date;
import lombok.Data;
import abc.base.BaseEntity;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.experimental.Accessors;

/**
* <p>
    * 在线账号
    * </p>
*
* @author linlurui
*/
@Data
@Accessors(chain = false)
@Component
@ColumnWidth(15) // 表头行宽
@HeadRowHeight(20) // 表头行高
public class OnlineTo extends BaseEntity<OnlineTo> implements IEntity<OnlineTo> {


    /**
    * 登录账号
    */
    @TableField("account")
    @ExcelProperty(value = "登录账号")
    private String account;

    /**
    * 登录平台
    */
    @TableField("platform")
    @ExcelProperty(value = "登录平台")
    private String platform;

    /**
    * 当前Token
    */
    @TableField("token")
    @ExcelProperty(value = "当前Token")
    private String token;

    /**
    * 登录时间
    */
    @ExcelIgnore
    @TableField(value = "login_time", fill = FieldFill.INSERT)
    @DateTimeFormat
    @ExcelProperty(value = "登录时间")
    private Date loginTime;

    /**
    * 账号状态
    */
    @TableField("account_state")
    @ExcelProperty(value = "账号状态")
    private Integer accountState;

    /**
    * 登录IP
    */
    @TableField("ip")
    @ExcelProperty(value = "登录IP")
    private String ip;

    /**
    * 过期时间
    */
    @TableField("expir")
    @JsonSerialize(using = ToStringSerializer.class)
    @ExcelProperty(value = "过期时间")
    private Long expir;

    /**
    * 私钥
    */
    @TableField("private_key")
    @ExcelProperty(value = "私钥")
    private String privateKey;

    @ExcelIgnore
    @TableField(exist = false)
    @Associative(table="online_attr", foreignKey="online_id", type=OnlineAttrTo.class)
    @ExcelProperty(value = "")
    private List<OnlineAttrTo> onlineAttrList;

}
